package lec03.am.p1;

public class Point {
	
	public Point getMid(Point that)
	{
		Point result=new Point();
		result.setX((this.x+that.x)/2);
		result.setY((this.y+that.y)/2);
		
		return result;
	}
//	static public int static_publicField;
//	static int static_defaultField;
//	static protected int static_protectedField;
//	static private int static_privateField;
//	public int publicField;
//	int defaultField;
//	protected int protectedField;
//	private int privateField;
	
	public final static Point ZERO=new Point();
	int x;
	int y;

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}

	public Point() {
		this.x = 0;
		this.y = 0;
	}

	public Point(int i, int j) {
		this.x = i;
		this.y = j;
	}

	public Point(int i) {
		this.x = i;
		this.y = 0;

	}

	public Point(Point p) {
		this.x = p.x;
		this.y = p.y;
	}

	// void f(int j)
	// {
	// int x=0;
	// x++;
	// }
	public double getDistance(Point that) {
		int dx = this.x - that.x;
		int dy = this.y - that.y;

		return Math.sqrt(dx * dx + dy * dy);
	}

	public void setX(int i) {
		this.x=i;
		
	}
	@Override
	public String toString()
	{
		return String.format("(%d,%d)", x,y);
	}
	@Override
	public boolean equals(Object obj) {
		// TODO Auto-generated method stub
		return super.equals(obj);
	}

	public int getX() {
		return this.x;
	}

	public double getR() {
		return this.getDistance(ZERO);
	}

}
